﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Networking;

[RequireComponent(typeof(Life)), NetworkSettings(sendInterval=0f)]
public class Inventory : CharacterBehaviour
{
    [CompilerGenerated]
    private static Func<Item, KeyValuePair<string, uint>> <>f__am$cache10;
    [CompilerGenerated]
    private static OnValueChangedEvent<Suit> <>f__am$cacheE;
    [CompilerGenerated]
    private static Func<Item, bool> <>f__am$cacheF;
    public GameObject initialSuit;
    private static int kCmdCmdCreateSuit = -1048973883;
    private static int kCmdCmdDestroyItem;
    private static int kCmdCmdDestroySuit;
    private static int kCmdCmdDropItem;
    private static int kCmdCmdPickup;
    private static int kCmdCmdSwitchWeapon;
    private static int kListsyncConsumableKeys;
    private static int kListsyncConsumableValues;
    private Weapon m_secondWeapon;
    private Suit m_suit;
    private Weapon m_weapon;
    public Transform secondWeaponModelParent;
    public Transform suitModelParent;
    [SyncVar]
    private SyncListString syncConsumableKeys = new SyncListString();
    private SyncDict<string, uint> syncConsumables;
    [SyncVar]
    private SyncListUInt syncConsumableValues = new SyncListUInt();
    [SyncVar(hook="OnSyncSecondWeaponIdChanged")]
    private NetworkInstanceId syncSecondWeaponId;
    [SyncVar(hook="OnSyncSuitIdChanged")]
    private NetworkInstanceId syncSuitId;
    [SyncVar(hook="OnSyncWeaponIdChanged")]
    private NetworkInstanceId syncWeaponId;
    public Transform weaponModelParent;

    public event OnValueChangedEvent<Suit> onSuitChanged;

    static Inventory()
    {
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdCreateSuit, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdCreateSuit));
        kCmdCmdDestroyItem = 0x15a9ca11;
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdDestroyItem, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdDestroyItem));
        kCmdCmdPickup = 0x1ff0e418;
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdPickup, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdPickup));
        kCmdCmdDestroySuit = 0x15ae5a0b;
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdDestroySuit, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdDestroySuit));
        kCmdCmdDropItem = -109121218;
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdDropItem, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdDropItem));
        kCmdCmdSwitchWeapon = 0x3f2e630c;
        NetworkBehaviour.RegisterCommandDelegate(typeof(Inventory), kCmdCmdSwitchWeapon, new NetworkBehaviour.CmdDelegate(Inventory.InvokeCmdCmdSwitchWeapon));
        kListsyncConsumableKeys = -864415120;
        NetworkBehaviour.RegisterSyncListDelegate(typeof(Inventory), kListsyncConsumableKeys, new NetworkBehaviour.CmdDelegate(Inventory.InvokeSyncListsyncConsumableKeys));
        kListsyncConsumableValues = -1463397730;
        NetworkBehaviour.RegisterSyncListDelegate(typeof(Inventory), kListsyncConsumableValues, new NetworkBehaviour.CmdDelegate(Inventory.InvokeSyncListsyncConsumableValues));
        NetworkCRC.RegisterBehaviour("Inventory", 0);
    }

    public Inventory()
    {
        if (<>f__am$cacheE == null)
        {
            <>f__am$cacheE = new OnValueChangedEvent<Suit>(Inventory.<onSuitChanged>m__51);
        }
        this.onSuitChanged = <>f__am$cacheE;
    }

    [CompilerGenerated]
    private static void <onSuitChanged>m__51(Suit item, Suit lastItem)
    {
    }

    protected override void Awake()
    {
        base.Awake();
        this.syncConsumables = new SyncDict<string, uint>(this.syncConsumableKeys, this.syncConsumableValues);
        base.life.onDie += delegate {
            this.SetWeapon(null);
            this.SetSecondWeapon(null);
        };
        this.syncConsumableKeys.InitializeBehaviour(this, kListsyncConsumableKeys);
        this.syncConsumableValues.InitializeBehaviour(this, kListsyncConsumableValues);
    }

    public void CallCmdCreateSuit(string assetName)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdCreateSuit called on server.");
        }
        else if (base.isServer)
        {
            this.CmdCreateSuit(assetName);
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdCreateSuit);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            writer.Write(assetName);
            base.SendCommandInternal(writer, 0, "CmdCreateSuit");
        }
    }

    public void CallCmdDestroyItem(NetworkInstanceId itemId)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdDestroyItem called on server.");
        }
        else if (base.isServer)
        {
            this.CmdDestroyItem(itemId);
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdDestroyItem);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            writer.Write(itemId);
            base.SendCommandInternal(writer, 0, "CmdDestroyItem");
        }
    }

    public void CallCmdDestroySuit()
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdDestroySuit called on server.");
        }
        else if (base.isServer)
        {
            this.CmdDestroySuit();
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdDestroySuit);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            base.SendCommandInternal(writer, 0, "CmdDestroySuit");
        }
    }

    public void CallCmdDropItem(NetworkInstanceId itemId)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdDropItem called on server.");
        }
        else if (base.isServer)
        {
            this.CmdDropItem(itemId);
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdDropItem);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            writer.Write(itemId);
            base.SendCommandInternal(writer, 0, "CmdDropItem");
        }
    }

    public void CallCmdPickup(NetworkInstanceId itemId)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdPickup called on server.");
        }
        else if (base.isServer)
        {
            this.CmdPickup(itemId);
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdPickup);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            writer.Write(itemId);
            base.SendCommandInternal(writer, 0, "CmdPickup");
        }
    }

    public void CallCmdSwitchWeapon()
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("Command function CmdSwitchWeapon called on server.");
        }
        else if (base.isServer)
        {
            this.CmdSwitchWeapon();
        }
        else
        {
            NetworkWriter writer = new NetworkWriter();
            writer.Write((short) 0);
            writer.Write((short) ((ushort) 5));
            writer.WritePackedUInt32((uint) kCmdCmdSwitchWeapon);
            writer.Write(base.GetComponent<NetworkIdentity>().netId);
            base.SendCommandInternal(writer, 0, "CmdSwitchWeapon");
        }
    }

    [Command]
    private void CmdCreateSuit(string assetName)
    {
        if (AssetManager.HasAsset(assetName))
        {
            Suit suit = GameUtility.CreateObject<Suit>(assetName, base.transform.position);
            this.SetSuit(suit);
        }
    }

    [Command]
    private void CmdDestroyItem(NetworkInstanceId itemId)
    {
        Item component = itemId.GetComponent<Item>();
        if ((component != null) && (component.user == base.self))
        {
            component.DestroyItem();
        }
        if (component == this.weapon)
        {
            base.self.PlayUseItemAnimation(null);
        }
    }

    [Command]
    private void CmdDestroySuit()
    {
        Suit suit = this.suit;
        this.SetSuit(null);
        suit.DestroyItem();
        this.initialSuit.SetActive(true);
    }

    [Command]
    private void CmdDropItem(NetworkInstanceId itemId)
    {
        Item component = itemId.GetComponent<Item>();
        if (component != null)
        {
            if (component == this.weapon)
            {
                this.SetWeapon(null);
            }
            if (component == this.secondWeapon)
            {
                this.SetSecondWeapon(null);
            }
        }
    }

    [Command]
    private void CmdPickup(NetworkInstanceId itemId)
    {
        this.PickupInternal(itemId.GetComponent<Item>());
    }

    [Command]
    private void CmdSwitchWeapon()
    {
        this.SwitchWeaponInternal();
    }

    public void CreateSuit(string assetName)
    {
        if (base.hasAuthority)
        {
            this.CallCmdCreateSuit(assetName);
        }
    }

    public void DestroyItem(Item item)
    {
        if (base.hasAuthority)
        {
            this.CallCmdDestroyItem(item.netId);
        }
    }

    public void DestroySuit()
    {
        if (this.suit != null)
        {
            this.CallCmdDestroySuit();
        }
    }

    public void DropSecondWeapon()
    {
        if (this.secondWeapon != null)
        {
            this.CallCmdDropItem(this.secondWeapon.netId);
        }
    }

    public void DropWeapon()
    {
        if (this.weapon != null)
        {
            this.CallCmdDropItem(this.weapon.netId);
        }
    }

    [Server]
    public Item GainItem(string assetName)
    {
        if (!NetworkServer.active)
        {
            Debug.LogWarning("[Server] function 'Item Inventory::GainItem(System.String)' called on client");
            return new Item();
        }
        if (!AssetManager.HasAsset(assetName))
        {
            return null;
        }
        Item item = GameUtility.CreateObject<Item>(assetName, base.transform.position);
        if ((item != null) && item.CanPickup(base.self))
        {
            this.PickupInternal(item);
        }
        return item;
    }

    public Dictionary<string, uint> GetAllConsumables()
    {
        return this.syncConsumables.dict;
    }

    public IEnumerable<KeyValuePair<string, uint>> GetAllItems()
    {
        Item[] source = new Item[] { this.suit, this.weapon, this.secondWeapon };
        if (<>f__am$cacheF == null)
        {
            <>f__am$cacheF = x => x != null;
        }
        if (<>f__am$cache10 == null)
        {
            <>f__am$cache10 = x => new KeyValuePair<string, uint>(x.name, 1);
        }
        return source.Where<Item>(<>f__am$cacheF).Select<Item, KeyValuePair<string, uint>>(<>f__am$cache10).Concat<KeyValuePair<string, uint>>(this.syncConsumables.dict);
    }

    public int GetConsumableAmount(string itemName)
    {
        return this.syncConsumables.GetValue(itemName);
    }

    public override float GetNetworkSendInterval()
    {
        return 0f;
    }

    public void IncreaseConsumableAmount(string itemName, int amount)
    {
        int consumableAmount = this.GetConsumableAmount(itemName);
        this.SetConsumableAmount(itemName, consumableAmount + amount);
    }

    protected static void InvokeCmdCmdCreateSuit(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdCreateSuit called on client.");
        }
        else
        {
            ((Inventory) obj).CmdCreateSuit(reader.ReadString());
        }
    }

    protected static void InvokeCmdCmdDestroyItem(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdDestroyItem called on client.");
        }
        else
        {
            ((Inventory) obj).CmdDestroyItem(reader.ReadNetworkId());
        }
    }

    protected static void InvokeCmdCmdDestroySuit(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdDestroySuit called on client.");
        }
        else
        {
            ((Inventory) obj).CmdDestroySuit();
        }
    }

    protected static void InvokeCmdCmdDropItem(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdDropItem called on client.");
        }
        else
        {
            ((Inventory) obj).CmdDropItem(reader.ReadNetworkId());
        }
    }

    protected static void InvokeCmdCmdPickup(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdPickup called on client.");
        }
        else
        {
            ((Inventory) obj).CmdPickup(reader.ReadNetworkId());
        }
    }

    protected static void InvokeCmdCmdSwitchWeapon(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkServer.active)
        {
            Debug.LogError("Command CmdSwitchWeapon called on client.");
        }
        else
        {
            ((Inventory) obj).CmdSwitchWeapon();
        }
    }

    protected static void InvokeSyncListsyncConsumableKeys(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("SyncList syncConsumableKeys called on server.");
        }
        else
        {
            ((Inventory) obj).syncConsumableKeys.HandleMsg(reader);
        }
    }

    protected static void InvokeSyncListsyncConsumableValues(NetworkBehaviour obj, NetworkReader reader)
    {
        if (!NetworkClient.active)
        {
            Debug.LogError("SyncList syncConsumableValues called on server.");
        }
        else
        {
            ((Inventory) obj).syncConsumableValues.HandleMsg(reader);
        }
    }

    public override void OnDeserialize(NetworkReader reader, bool initialState)
    {
        base.OnDeserialize(reader, initialState);
        if (initialState)
        {
            this.syncSuitId = reader.ReadNetworkId();
            this.syncWeaponId = reader.ReadNetworkId();
            this.syncSecondWeaponId = reader.ReadNetworkId();
            SyncListString.ReadReference(reader, this.syncConsumableKeys);
            SyncListString.ReadReference(reader, this.syncConsumableKeys);
            SyncListUInt.ReadReference(reader, this.syncConsumableValues);
            SyncListUInt.ReadReference(reader, this.syncConsumableValues);
        }
        else
        {
            int num = (int) reader.ReadPackedUInt32();
            if ((num & 1) != 0)
            {
                this.OnSyncSuitIdChanged(reader.ReadNetworkId());
            }
            if ((num & 2) != 0)
            {
                this.OnSyncWeaponIdChanged(reader.ReadNetworkId());
            }
            if ((num & 4) != 0)
            {
                this.OnSyncSecondWeaponIdChanged(reader.ReadNetworkId());
            }
            if ((num & 8) != 0)
            {
                SyncListString.ReadReference(reader, this.syncConsumableKeys);
            }
            if ((num & 0x10) != 0)
            {
                SyncListString.ReadReference(reader, this.syncConsumableKeys);
            }
            if ((num & 0x20) != 0)
            {
                SyncListUInt.ReadReference(reader, this.syncConsumableValues);
            }
            if ((num & 0x40) != 0)
            {
                SyncListUInt.ReadReference(reader, this.syncConsumableValues);
            }
        }
    }

    public override bool OnSerialize(NetworkWriter writer, bool forceAll)
    {
        bool flag2 = base.OnSerialize(writer, forceAll);
        if (forceAll)
        {
            writer.Write(this.syncSuitId);
            writer.Write(this.syncWeaponId);
            writer.Write(this.syncSecondWeaponId);
            SyncListString.WriteInstance(writer, this.syncConsumableKeys);
            SyncListString.WriteInstance(writer, this.syncConsumableKeys);
            SyncListUInt.WriteInstance(writer, this.syncConsumableValues);
            SyncListUInt.WriteInstance(writer, this.syncConsumableValues);
            return true;
        }
        bool flag = false;
        if ((base.syncVarDirtyBits & 1) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            writer.Write(this.syncSuitId);
        }
        if ((base.syncVarDirtyBits & 2) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            writer.Write(this.syncWeaponId);
        }
        if ((base.syncVarDirtyBits & 4) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            writer.Write(this.syncSecondWeaponId);
        }
        if ((base.syncVarDirtyBits & 8) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            SyncListString.WriteInstance(writer, this.syncConsumableKeys);
        }
        if ((base.syncVarDirtyBits & 0x10) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            SyncListString.WriteInstance(writer, this.syncConsumableKeys);
        }
        if ((base.syncVarDirtyBits & 0x20) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            SyncListUInt.WriteInstance(writer, this.syncConsumableValues);
        }
        if ((base.syncVarDirtyBits & 0x40) != 0)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            SyncListUInt.WriteInstance(writer, this.syncConsumableValues);
        }
        if (!flag)
        {
            writer.WritePackedUInt32(base.syncVarDirtyBits);
        }
        return (flag | flag2);
    }

    public override void OnStartClient()
    {
        base.OnStartClient();
        if (!this.syncSuitId.IsEmpty())
        {
            this.StartWaitUntil(() => this.syncSuitId.GetComponent<Suit>() != null, () => this.SetSuit(this.syncSuitId.GetComponent<Suit>()));
        }
        if (!this.syncWeaponId.IsEmpty())
        {
            this.StartWaitUntil(() => this.syncWeaponId.GetComponent<Weapon>() != null, () => this.SetWeapon(this.syncWeaponId.GetComponent<Weapon>()));
        }
        if (!this.syncSecondWeaponId.IsEmpty())
        {
            this.StartWaitUntil(() => this.syncSecondWeaponId.GetComponent<Weapon>() != null, () => this.SetSecondWeapon(this.syncSecondWeaponId.GetComponent<Weapon>()));
        }
        this.syncConsumables.OnStartClient();
    }

    private void OnSyncSecondWeaponIdChanged(NetworkInstanceId id)
    {
        this.SetSecondWeapon(id.GetComponent<Weapon>());
    }

    private void OnSyncSuitIdChanged(NetworkInstanceId id)
    {
        this.SetSuit(id.GetComponent<Suit>());
    }

    private void OnSyncWeaponIdChanged(NetworkInstanceId id)
    {
        this.SetWeapon(id.GetComponent<Weapon>());
    }

    public void Pickup(Item item)
    {
        if (base.hasAuthority && ((item != null) && item.CanPickup(base.self)))
        {
            this.CallCmdPickup(item.netId);
        }
    }

    private void PickupInternal(Item item)
    {
        if (((item != null) && (item.user == null)) && item.CanPickup(base.self))
        {
            Vector3 position = item.transform.position;
            if (pickupEffect != null)
            {
                pickupEffect.Spawn<Effect>(position);
            }
            item.Pickup(base.self);
            if (item is Suit)
            {
                this.SetSuit(item as Suit);
            }
            else
            {
                Weapon weapon = item as Weapon;
                if (weapon != null)
                {
                    if (this.weapon != null)
                    {
                        Weapon weapon2 = this.weapon;
                        this.SetWeapon(null);
                        this.SetSecondWeapon(weapon2);
                    }
                    this.SetWeapon(weapon);
                }
            }
        }
    }

    public void SetConsumableAmount(string itemName, int amount)
    {
        this.syncConsumables.SetValue(itemName, (uint) amount);
    }

    private void SetEquipment<T>(ref T prop, T value, Transform equipmentModelParent, OnValueChangedEvent<T> onValueChanged = null) where T: Item
    {
        T lastValue = prop;
        if (value != lastValue)
        {
            if (lastValue != null)
            {
                lastValue.Drop(base.self.transform.position + ((Vector3) (UnityEngine.Random.insideUnitSphere.SetY(0f) * 0.2f)));
            }
            if (value != null)
            {
                value.Pickup(base.self);
                value.Equip(equipmentModelParent);
            }
            prop = value;
            if (onValueChanged != null)
            {
                onValueChanged(value, lastValue);
            }
        }
    }

    private void SetSecondWeapon(Weapon value)
    {
        this.SetEquipment<Weapon>(ref this.m_secondWeapon, value, this.secondWeaponModelParent, null);
        this.NetworksyncSecondWeaponId = (value == null) ? NetworkInstanceId.Invalid : value.netId;
        if ((value != null) && (value.modelInstance != null))
        {
            value.modelInstance.transform.localPosition = -value.model.GetOffset();
        }
    }

    private void SetSuit(Suit value)
    {
        if (this.initialSuit != null)
        {
            this.initialSuit.SetActive(value == 0);
        }
        this.SetEquipment<Suit>(ref this.m_suit, value, this.suitModelParent, this.onSuitChanged);
        this.NetworksyncSuitId = (value == null) ? NetworkInstanceId.Invalid : value.netId;
    }

    private void SetWeapon(Weapon value)
    {
        this.SetEquipment<Weapon>(ref this.m_weapon, value, this.weaponModelParent, null);
        this.NetworksyncWeaponId = (value == null) ? NetworkInstanceId.Invalid : value.netId;
        Attack component = base.GetComponent<Attack>();
        if (component != null)
        {
            component.weapon = value;
        }
        if (!base.life.isDied)
        {
            base.self.PlayUseItemAnimation((value == null) ? null : value.useAnimation);
        }
    }

    public void SwitchWeapon()
    {
        this.CallCmdSwitchWeapon();
    }

    private void SwitchWeaponInternal()
    {
        <SwitchWeaponInternal>c__AnonStorey45 storey = new <SwitchWeaponInternal>c__AnonStorey45 {
            <>f__this = this
        };
        if (this.secondWeapon != null)
        {
            Weapon weapon = this.weapon;
            storey.tempSecond = this.secondWeapon;
            this.SetWeapon(null);
            this.SetSecondWeapon(weapon);
            this.StartWaitForFrames(1, new Action(storey.<>m__5B));
        }
    }

    private void UNetVersion()
    {
    }

    public int money
    {
        get
        {
            return this.GetConsumableAmount("__Builtin/Prefabs/Items/Consumables/Money");
        }
        set
        {
            this.SetConsumableAmount("__Builtin/Prefabs/Items/Consumables/Money", value);
        }
    }

    public SyncListString NetworksyncConsumableKeys
    {
        get
        {
            return this.syncConsumableKeys;
        }
        [param: In]
        set
        {
            base.SetSyncVar<SyncListString>(value, ref this.syncConsumableKeys, 8);
        }
    }

    public SyncListUInt NetworksyncConsumableValues
    {
        get
        {
            return this.syncConsumableValues;
        }
        [param: In]
        set
        {
            base.SetSyncVar<SyncListUInt>(value, ref this.syncConsumableValues, 0x20);
        }
    }

    public NetworkInstanceId NetworksyncSecondWeaponId
    {
        get
        {
            return this.syncSecondWeaponId;
        }
        [param: In]
        set
        {
            if (NetworkServer.localClientActive && !base.syncVarHookGuard)
            {
                base.syncVarHookGuard = true;
                this.OnSyncSecondWeaponIdChanged(value);
                base.syncVarHookGuard = false;
            }
            base.SetSyncVar<NetworkInstanceId>(value, ref this.syncSecondWeaponId, 4);
        }
    }

    public NetworkInstanceId NetworksyncSuitId
    {
        get
        {
            return this.syncSuitId;
        }
        [param: In]
        set
        {
            if (NetworkServer.localClientActive && !base.syncVarHookGuard)
            {
                base.syncVarHookGuard = true;
                this.OnSyncSuitIdChanged(value);
                base.syncVarHookGuard = false;
            }
            base.SetSyncVar<NetworkInstanceId>(value, ref this.syncSuitId, 1);
        }
    }

    public NetworkInstanceId NetworksyncWeaponId
    {
        get
        {
            return this.syncWeaponId;
        }
        [param: In]
        set
        {
            if (NetworkServer.localClientActive && !base.syncVarHookGuard)
            {
                base.syncVarHookGuard = true;
                this.OnSyncWeaponIdChanged(value);
                base.syncVarHookGuard = false;
            }
            base.SetSyncVar<NetworkInstanceId>(value, ref this.syncWeaponId, 2);
        }
    }

    private static Effect pickupEffect
    {
        get
        {
            return GameResources.Effects.Pickup;
        }
    }

    public Weapon secondWeapon
    {
        get
        {
            return this.m_secondWeapon;
        }
    }

    public Suit suit
    {
        get
        {
            return this.m_suit;
        }
    }

    public Weapon weapon
    {
        get
        {
            return this.m_weapon;
        }
    }

    public float weight
    {
        get
        {
            return (((this.weapon == null) ? 0f : this.weapon.weight) + ((this.secondWeapon == null) ? 0f : this.secondWeapon.weight));
        }
    }

    [CompilerGenerated]
    private sealed class <SwitchWeaponInternal>c__AnonStorey45
    {
        internal Inventory <>f__this;
        internal Weapon tempSecond;

        internal void <>m__5B()
        {
            this.<>f__this.SetWeapon(this.tempSecond);
        }
    }
}

